package utils;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.*;

public class RandomGenerator {
    public Random g;
    public RandomGenerator() {
        this.g = new Random();
    }
    public String generateRandomNumbers(int N, String path) throws IOException {
        int[] data = new int[N];
        for (int index=0; index<N; index++) data[index] = index-N/2;
        List<Integer> random = Arrays.asList(Arrays.stream(data).boxed().toArray(Integer[]::new));
        Collections.shuffle(random);
//        data = Arrays.stream((Integer[]) random.toArray()).mapToInt(Integer::valueOf).toArray();


//        BufferedWriter out = new BufferedWriter(new FileWriter(path));

        FileWriter writer = new FileWriter(path, false);
        for (Integer i: random) {
            writer.write(i+" ");
        }
        writer.close();
        return path;
    }

}
